<?php


abstract class BaseUser extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $name;


	
	protected $lypo_signature;


	
	protected $thumbnail_url;


	
	protected $city;


	
	protected $country;


	
	protected $gender;


	
	protected $age;


	
	protected $keywords;


	
	protected $origin;


	
	protected $enemy;


	
	protected $occupation;


	
	protected $cached_statement_text;


	
	protected $cached_reaction_text;


	
	protected $cached_statement_id;


	
	protected $num_respects = 0;


	
	protected $show_profile = 1;


	
	protected $created_at;


	
	protected $updated_at;

	
	protected $collUserContainers;

	
	protected $lastUserContainerCriteria = null;

	
	protected $collUserNetworkCodes;

	
	protected $lastUserNetworkCodeCriteria = null;

	
	protected $collPerfectOppositesRelatedByUserId;

	
	protected $lastPerfectOppositeRelatedByUserIdCriteria = null;

	
	protected $collPerfectOppositesRelatedByOppositeId;

	
	protected $lastPerfectOppositeRelatedByOppositeIdCriteria = null;

	
	protected $collStatementAnswers;

	
	protected $lastStatementAnswerCriteria = null;

	
	protected $collReactions;

	
	protected $lastReactionCriteria = null;

	
	protected $collReactionRespects;

	
	protected $lastReactionRespectCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getName()
	{

		return $this->name;
	}

	
	public function getLypoSignature()
	{

		return $this->lypo_signature;
	}

	
	public function getThumbnailUrl()
	{

		return $this->thumbnail_url;
	}

	
	public function getCity()
	{

		return $this->city;
	}

	
	public function getCountry()
	{

		return $this->country;
	}

	
	public function getGender()
	{

		return $this->gender;
	}

	
	public function getAge()
	{

		return $this->age;
	}

	
	public function getKeywords()
	{

		return $this->keywords;
	}

	
	public function getOrigin()
	{

		return $this->origin;
	}

	
	public function getEnemy()
	{

		return $this->enemy;
	}

	
	public function getOccupation()
	{

		return $this->occupation;
	}

	
	public function getCachedStatementText()
	{

		return $this->cached_statement_text;
	}

	
	public function getCachedReactionText()
	{

		return $this->cached_reaction_text;
	}

	
	public function getCachedStatementId()
	{

		return $this->cached_statement_id;
	}

	
	public function getNumRespects()
	{

		return $this->num_respects;
	}

	
	public function getShowProfile()
	{

		return $this->show_profile;
	}

	
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
						$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getUpdatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->updated_at === null || $this->updated_at === '') {
			return null;
		} elseif (!is_int($this->updated_at)) {
						$ts = strtotime($this->updated_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
			}
		} else {
			$ts = $this->updated_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function setId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = UserPeer::ID;
		}

	} 
	
	public function setName($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->name !== $v) {
			$this->name = $v;
			$this->modifiedColumns[] = UserPeer::NAME;
		}

	} 
	
	public function setLypoSignature($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->lypo_signature !== $v) {
			$this->lypo_signature = $v;
			$this->modifiedColumns[] = UserPeer::LYPO_SIGNATURE;
		}

	} 
	
	public function setThumbnailUrl($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->thumbnail_url !== $v) {
			$this->thumbnail_url = $v;
			$this->modifiedColumns[] = UserPeer::THUMBNAIL_URL;
		}

	} 
	
	public function setCity($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->city !== $v) {
			$this->city = $v;
			$this->modifiedColumns[] = UserPeer::CITY;
		}

	} 
	
	public function setCountry($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->country !== $v) {
			$this->country = $v;
			$this->modifiedColumns[] = UserPeer::COUNTRY;
		}

	} 
	
	public function setGender($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->gender !== $v) {
			$this->gender = $v;
			$this->modifiedColumns[] = UserPeer::GENDER;
		}

	} 
	
	public function setAge($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->age !== $v) {
			$this->age = $v;
			$this->modifiedColumns[] = UserPeer::AGE;
		}

	} 
	
	public function setKeywords($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->keywords !== $v) {
			$this->keywords = $v;
			$this->modifiedColumns[] = UserPeer::KEYWORDS;
		}

	} 
	
	public function setOrigin($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->origin !== $v) {
			$this->origin = $v;
			$this->modifiedColumns[] = UserPeer::ORIGIN;
		}

	} 
	
	public function setEnemy($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->enemy !== $v) {
			$this->enemy = $v;
			$this->modifiedColumns[] = UserPeer::ENEMY;
		}

	} 
	
	public function setOccupation($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->occupation !== $v) {
			$this->occupation = $v;
			$this->modifiedColumns[] = UserPeer::OCCUPATION;
		}

	} 
	
	public function setCachedStatementText($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cached_statement_text !== $v) {
			$this->cached_statement_text = $v;
			$this->modifiedColumns[] = UserPeer::CACHED_STATEMENT_TEXT;
		}

	} 
	
	public function setCachedReactionText($v)
	{

						if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->cached_reaction_text !== $v) {
			$this->cached_reaction_text = $v;
			$this->modifiedColumns[] = UserPeer::CACHED_REACTION_TEXT;
		}

	} 
	
	public function setCachedStatementId($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->cached_statement_id !== $v) {
			$this->cached_statement_id = $v;
			$this->modifiedColumns[] = UserPeer::CACHED_STATEMENT_ID;
		}

	} 
	
	public function setNumRespects($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->num_respects !== $v || $v === 0) {
			$this->num_respects = $v;
			$this->modifiedColumns[] = UserPeer::NUM_RESPECTS;
		}

	} 
	
	public function setShowProfile($v)
	{

						if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->show_profile !== $v || $v === 1) {
			$this->show_profile = $v;
			$this->modifiedColumns[] = UserPeer::SHOW_PROFILE;
		}

	} 
	
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = UserPeer::CREATED_AT;
		}

	} 
	
	public function setUpdatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->updated_at !== $ts) {
			$this->updated_at = $ts;
			$this->modifiedColumns[] = UserPeer::UPDATED_AT;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->name = $rs->getString($startcol + 1);

			$this->lypo_signature = $rs->getString($startcol + 2);

			$this->thumbnail_url = $rs->getString($startcol + 3);

			$this->city = $rs->getString($startcol + 4);

			$this->country = $rs->getString($startcol + 5);

			$this->gender = $rs->getString($startcol + 6);

			$this->age = $rs->getInt($startcol + 7);

			$this->keywords = $rs->getString($startcol + 8);

			$this->origin = $rs->getString($startcol + 9);

			$this->enemy = $rs->getString($startcol + 10);

			$this->occupation = $rs->getString($startcol + 11);

			$this->cached_statement_text = $rs->getString($startcol + 12);

			$this->cached_reaction_text = $rs->getString($startcol + 13);

			$this->cached_statement_id = $rs->getInt($startcol + 14);

			$this->num_respects = $rs->getInt($startcol + 15);

			$this->show_profile = $rs->getInt($startcol + 16);

			$this->created_at = $rs->getTimestamp($startcol + 17, null);

			$this->updated_at = $rs->getTimestamp($startcol + 18, null);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 19; 
		} catch (Exception $e) {
			throw new PropelException("Error populating User object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(UserPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			UserPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isNew() && !$this->isColumnModified(UserPeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

    if ($this->isModified() && !$this->isColumnModified(UserPeer::UPDATED_AT))
    {
      $this->setUpdatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(UserPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = UserPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += UserPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collUserContainers !== null) {
				foreach($this->collUserContainers as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collUserNetworkCodes !== null) {
				foreach($this->collUserNetworkCodes as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collPerfectOppositesRelatedByUserId !== null) {
				foreach($this->collPerfectOppositesRelatedByUserId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collPerfectOppositesRelatedByOppositeId !== null) {
				foreach($this->collPerfectOppositesRelatedByOppositeId as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collStatementAnswers !== null) {
				foreach($this->collStatementAnswers as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collReactions !== null) {
				foreach($this->collReactions as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			if ($this->collReactionRespects !== null) {
				foreach($this->collReactionRespects as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = UserPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collUserContainers !== null) {
					foreach($this->collUserContainers as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collUserNetworkCodes !== null) {
					foreach($this->collUserNetworkCodes as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collPerfectOppositesRelatedByUserId !== null) {
					foreach($this->collPerfectOppositesRelatedByUserId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collPerfectOppositesRelatedByOppositeId !== null) {
					foreach($this->collPerfectOppositesRelatedByOppositeId as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collStatementAnswers !== null) {
					foreach($this->collStatementAnswers as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collReactions !== null) {
					foreach($this->collReactions as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}

				if ($this->collReactionRespects !== null) {
					foreach($this->collReactionRespects as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = UserPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getName();
				break;
			case 2:
				return $this->getLypoSignature();
				break;
			case 3:
				return $this->getThumbnailUrl();
				break;
			case 4:
				return $this->getCity();
				break;
			case 5:
				return $this->getCountry();
				break;
			case 6:
				return $this->getGender();
				break;
			case 7:
				return $this->getAge();
				break;
			case 8:
				return $this->getKeywords();
				break;
			case 9:
				return $this->getOrigin();
				break;
			case 10:
				return $this->getEnemy();
				break;
			case 11:
				return $this->getOccupation();
				break;
			case 12:
				return $this->getCachedStatementText();
				break;
			case 13:
				return $this->getCachedReactionText();
				break;
			case 14:
				return $this->getCachedStatementId();
				break;
			case 15:
				return $this->getNumRespects();
				break;
			case 16:
				return $this->getShowProfile();
				break;
			case 17:
				return $this->getCreatedAt();
				break;
			case 18:
				return $this->getUpdatedAt();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = UserPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getName(),
			$keys[2] => $this->getLypoSignature(),
			$keys[3] => $this->getThumbnailUrl(),
			$keys[4] => $this->getCity(),
			$keys[5] => $this->getCountry(),
			$keys[6] => $this->getGender(),
			$keys[7] => $this->getAge(),
			$keys[8] => $this->getKeywords(),
			$keys[9] => $this->getOrigin(),
			$keys[10] => $this->getEnemy(),
			$keys[11] => $this->getOccupation(),
			$keys[12] => $this->getCachedStatementText(),
			$keys[13] => $this->getCachedReactionText(),
			$keys[14] => $this->getCachedStatementId(),
			$keys[15] => $this->getNumRespects(),
			$keys[16] => $this->getShowProfile(),
			$keys[17] => $this->getCreatedAt(),
			$keys[18] => $this->getUpdatedAt(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = UserPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setName($value);
				break;
			case 2:
				$this->setLypoSignature($value);
				break;
			case 3:
				$this->setThumbnailUrl($value);
				break;
			case 4:
				$this->setCity($value);
				break;
			case 5:
				$this->setCountry($value);
				break;
			case 6:
				$this->setGender($value);
				break;
			case 7:
				$this->setAge($value);
				break;
			case 8:
				$this->setKeywords($value);
				break;
			case 9:
				$this->setOrigin($value);
				break;
			case 10:
				$this->setEnemy($value);
				break;
			case 11:
				$this->setOccupation($value);
				break;
			case 12:
				$this->setCachedStatementText($value);
				break;
			case 13:
				$this->setCachedReactionText($value);
				break;
			case 14:
				$this->setCachedStatementId($value);
				break;
			case 15:
				$this->setNumRespects($value);
				break;
			case 16:
				$this->setShowProfile($value);
				break;
			case 17:
				$this->setCreatedAt($value);
				break;
			case 18:
				$this->setUpdatedAt($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = UserPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setName($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setLypoSignature($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setThumbnailUrl($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setCity($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setCountry($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setGender($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setAge($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setKeywords($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setOrigin($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setEnemy($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setOccupation($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setCachedStatementText($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setCachedReactionText($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setCachedStatementId($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setNumRespects($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setShowProfile($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]);
		if (array_key_exists($keys[18], $arr)) $this->setUpdatedAt($arr[$keys[18]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(UserPeer::DATABASE_NAME);

		if ($this->isColumnModified(UserPeer::ID)) $criteria->add(UserPeer::ID, $this->id);
		if ($this->isColumnModified(UserPeer::NAME)) $criteria->add(UserPeer::NAME, $this->name);
		if ($this->isColumnModified(UserPeer::LYPO_SIGNATURE)) $criteria->add(UserPeer::LYPO_SIGNATURE, $this->lypo_signature);
		if ($this->isColumnModified(UserPeer::THUMBNAIL_URL)) $criteria->add(UserPeer::THUMBNAIL_URL, $this->thumbnail_url);
		if ($this->isColumnModified(UserPeer::CITY)) $criteria->add(UserPeer::CITY, $this->city);
		if ($this->isColumnModified(UserPeer::COUNTRY)) $criteria->add(UserPeer::COUNTRY, $this->country);
		if ($this->isColumnModified(UserPeer::GENDER)) $criteria->add(UserPeer::GENDER, $this->gender);
		if ($this->isColumnModified(UserPeer::AGE)) $criteria->add(UserPeer::AGE, $this->age);
		if ($this->isColumnModified(UserPeer::KEYWORDS)) $criteria->add(UserPeer::KEYWORDS, $this->keywords);
		if ($this->isColumnModified(UserPeer::ORIGIN)) $criteria->add(UserPeer::ORIGIN, $this->origin);
		if ($this->isColumnModified(UserPeer::ENEMY)) $criteria->add(UserPeer::ENEMY, $this->enemy);
		if ($this->isColumnModified(UserPeer::OCCUPATION)) $criteria->add(UserPeer::OCCUPATION, $this->occupation);
		if ($this->isColumnModified(UserPeer::CACHED_STATEMENT_TEXT)) $criteria->add(UserPeer::CACHED_STATEMENT_TEXT, $this->cached_statement_text);
		if ($this->isColumnModified(UserPeer::CACHED_REACTION_TEXT)) $criteria->add(UserPeer::CACHED_REACTION_TEXT, $this->cached_reaction_text);
		if ($this->isColumnModified(UserPeer::CACHED_STATEMENT_ID)) $criteria->add(UserPeer::CACHED_STATEMENT_ID, $this->cached_statement_id);
		if ($this->isColumnModified(UserPeer::NUM_RESPECTS)) $criteria->add(UserPeer::NUM_RESPECTS, $this->num_respects);
		if ($this->isColumnModified(UserPeer::SHOW_PROFILE)) $criteria->add(UserPeer::SHOW_PROFILE, $this->show_profile);
		if ($this->isColumnModified(UserPeer::CREATED_AT)) $criteria->add(UserPeer::CREATED_AT, $this->created_at);
		if ($this->isColumnModified(UserPeer::UPDATED_AT)) $criteria->add(UserPeer::UPDATED_AT, $this->updated_at);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(UserPeer::DATABASE_NAME);

		$criteria->add(UserPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setName($this->name);

		$copyObj->setLypoSignature($this->lypo_signature);

		$copyObj->setThumbnailUrl($this->thumbnail_url);

		$copyObj->setCity($this->city);

		$copyObj->setCountry($this->country);

		$copyObj->setGender($this->gender);

		$copyObj->setAge($this->age);

		$copyObj->setKeywords($this->keywords);

		$copyObj->setOrigin($this->origin);

		$copyObj->setEnemy($this->enemy);

		$copyObj->setOccupation($this->occupation);

		$copyObj->setCachedStatementText($this->cached_statement_text);

		$copyObj->setCachedReactionText($this->cached_reaction_text);

		$copyObj->setCachedStatementId($this->cached_statement_id);

		$copyObj->setNumRespects($this->num_respects);

		$copyObj->setShowProfile($this->show_profile);

		$copyObj->setCreatedAt($this->created_at);

		$copyObj->setUpdatedAt($this->updated_at);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getUserContainers() as $relObj) {
				$copyObj->addUserContainer($relObj->copy($deepCopy));
			}

			foreach($this->getUserNetworkCodes() as $relObj) {
				$copyObj->addUserNetworkCode($relObj->copy($deepCopy));
			}

			foreach($this->getPerfectOppositesRelatedByUserId() as $relObj) {
				$copyObj->addPerfectOppositeRelatedByUserId($relObj->copy($deepCopy));
			}

			foreach($this->getPerfectOppositesRelatedByOppositeId() as $relObj) {
				$copyObj->addPerfectOppositeRelatedByOppositeId($relObj->copy($deepCopy));
			}

			foreach($this->getStatementAnswers() as $relObj) {
				$copyObj->addStatementAnswer($relObj->copy($deepCopy));
			}

			foreach($this->getReactions() as $relObj) {
				$copyObj->addReaction($relObj->copy($deepCopy));
			}

			foreach($this->getReactionRespects() as $relObj) {
				$copyObj->addReactionRespect($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new UserPeer();
		}
		return self::$peer;
	}

	
	public function initUserContainers()
	{
		if ($this->collUserContainers === null) {
			$this->collUserContainers = array();
		}
	}

	
	public function getUserContainers($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collUserContainers === null) {
			if ($this->isNew()) {
			   $this->collUserContainers = array();
			} else {

				$criteria->add(UserContainerPeer::USER_ID, $this->getId());

				UserContainerPeer::addSelectColumns($criteria);
				$this->collUserContainers = UserContainerPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(UserContainerPeer::USER_ID, $this->getId());

				UserContainerPeer::addSelectColumns($criteria);
				if (!isset($this->lastUserContainerCriteria) || !$this->lastUserContainerCriteria->equals($criteria)) {
					$this->collUserContainers = UserContainerPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastUserContainerCriteria = $criteria;
		return $this->collUserContainers;
	}

	
	public function countUserContainers($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(UserContainerPeer::USER_ID, $this->getId());

		return UserContainerPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addUserContainer(UserContainer $l)
	{
		$this->collUserContainers[] = $l;
		$l->setUser($this);
	}


	
	public function getUserContainersJoinContainer($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collUserContainers === null) {
			if ($this->isNew()) {
				$this->collUserContainers = array();
			} else {

				$criteria->add(UserContainerPeer::USER_ID, $this->getId());

				$this->collUserContainers = UserContainerPeer::doSelectJoinContainer($criteria, $con);
			}
		} else {
									
			$criteria->add(UserContainerPeer::USER_ID, $this->getId());

			if (!isset($this->lastUserContainerCriteria) || !$this->lastUserContainerCriteria->equals($criteria)) {
				$this->collUserContainers = UserContainerPeer::doSelectJoinContainer($criteria, $con);
			}
		}
		$this->lastUserContainerCriteria = $criteria;

		return $this->collUserContainers;
	}

	
	public function initUserNetworkCodes()
	{
		if ($this->collUserNetworkCodes === null) {
			$this->collUserNetworkCodes = array();
		}
	}

	
	public function getUserNetworkCodes($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collUserNetworkCodes === null) {
			if ($this->isNew()) {
			   $this->collUserNetworkCodes = array();
			} else {

				$criteria->add(UserNetworkCodePeer::USER_ID, $this->getId());

				UserNetworkCodePeer::addSelectColumns($criteria);
				$this->collUserNetworkCodes = UserNetworkCodePeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(UserNetworkCodePeer::USER_ID, $this->getId());

				UserNetworkCodePeer::addSelectColumns($criteria);
				if (!isset($this->lastUserNetworkCodeCriteria) || !$this->lastUserNetworkCodeCriteria->equals($criteria)) {
					$this->collUserNetworkCodes = UserNetworkCodePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastUserNetworkCodeCriteria = $criteria;
		return $this->collUserNetworkCodes;
	}

	
	public function countUserNetworkCodes($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(UserNetworkCodePeer::USER_ID, $this->getId());

		return UserNetworkCodePeer::doCount($criteria, $distinct, $con);
	}

	
	public function addUserNetworkCode(UserNetworkCode $l)
	{
		$this->collUserNetworkCodes[] = $l;
		$l->setUser($this);
	}

	
	public function initPerfectOppositesRelatedByUserId()
	{
		if ($this->collPerfectOppositesRelatedByUserId === null) {
			$this->collPerfectOppositesRelatedByUserId = array();
		}
	}

	
	public function getPerfectOppositesRelatedByUserId($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collPerfectOppositesRelatedByUserId === null) {
			if ($this->isNew()) {
			   $this->collPerfectOppositesRelatedByUserId = array();
			} else {

				$criteria->add(PerfectOppositePeer::USER_ID, $this->getId());

				PerfectOppositePeer::addSelectColumns($criteria);
				$this->collPerfectOppositesRelatedByUserId = PerfectOppositePeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(PerfectOppositePeer::USER_ID, $this->getId());

				PerfectOppositePeer::addSelectColumns($criteria);
				if (!isset($this->lastPerfectOppositeRelatedByUserIdCriteria) || !$this->lastPerfectOppositeRelatedByUserIdCriteria->equals($criteria)) {
					$this->collPerfectOppositesRelatedByUserId = PerfectOppositePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastPerfectOppositeRelatedByUserIdCriteria = $criteria;
		return $this->collPerfectOppositesRelatedByUserId;
	}

	
	public function countPerfectOppositesRelatedByUserId($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(PerfectOppositePeer::USER_ID, $this->getId());

		return PerfectOppositePeer::doCount($criteria, $distinct, $con);
	}

	
	public function addPerfectOppositeRelatedByUserId(PerfectOpposite $l)
	{
		$this->collPerfectOppositesRelatedByUserId[] = $l;
		$l->setUserRelatedByUserId($this);
	}

	
	public function initPerfectOppositesRelatedByOppositeId()
	{
		if ($this->collPerfectOppositesRelatedByOppositeId === null) {
			$this->collPerfectOppositesRelatedByOppositeId = array();
		}
	}

	
	public function getPerfectOppositesRelatedByOppositeId($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collPerfectOppositesRelatedByOppositeId === null) {
			if ($this->isNew()) {
			   $this->collPerfectOppositesRelatedByOppositeId = array();
			} else {

				$criteria->add(PerfectOppositePeer::OPPOSITE_ID, $this->getId());

				PerfectOppositePeer::addSelectColumns($criteria);
				$this->collPerfectOppositesRelatedByOppositeId = PerfectOppositePeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(PerfectOppositePeer::OPPOSITE_ID, $this->getId());

				PerfectOppositePeer::addSelectColumns($criteria);
				if (!isset($this->lastPerfectOppositeRelatedByOppositeIdCriteria) || !$this->lastPerfectOppositeRelatedByOppositeIdCriteria->equals($criteria)) {
					$this->collPerfectOppositesRelatedByOppositeId = PerfectOppositePeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastPerfectOppositeRelatedByOppositeIdCriteria = $criteria;
		return $this->collPerfectOppositesRelatedByOppositeId;
	}

	
	public function countPerfectOppositesRelatedByOppositeId($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(PerfectOppositePeer::OPPOSITE_ID, $this->getId());

		return PerfectOppositePeer::doCount($criteria, $distinct, $con);
	}

	
	public function addPerfectOppositeRelatedByOppositeId(PerfectOpposite $l)
	{
		$this->collPerfectOppositesRelatedByOppositeId[] = $l;
		$l->setUserRelatedByOppositeId($this);
	}

	
	public function initStatementAnswers()
	{
		if ($this->collStatementAnswers === null) {
			$this->collStatementAnswers = array();
		}
	}

	
	public function getStatementAnswers($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStatementAnswers === null) {
			if ($this->isNew()) {
			   $this->collStatementAnswers = array();
			} else {

				$criteria->add(StatementAnswerPeer::USER_ID, $this->getId());

				StatementAnswerPeer::addSelectColumns($criteria);
				$this->collStatementAnswers = StatementAnswerPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(StatementAnswerPeer::USER_ID, $this->getId());

				StatementAnswerPeer::addSelectColumns($criteria);
				if (!isset($this->lastStatementAnswerCriteria) || !$this->lastStatementAnswerCriteria->equals($criteria)) {
					$this->collStatementAnswers = StatementAnswerPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastStatementAnswerCriteria = $criteria;
		return $this->collStatementAnswers;
	}

	
	public function countStatementAnswers($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(StatementAnswerPeer::USER_ID, $this->getId());

		return StatementAnswerPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addStatementAnswer(StatementAnswer $l)
	{
		$this->collStatementAnswers[] = $l;
		$l->setUser($this);
	}


	
	public function getStatementAnswersJoinLypoStatement($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collStatementAnswers === null) {
			if ($this->isNew()) {
				$this->collStatementAnswers = array();
			} else {

				$criteria->add(StatementAnswerPeer::USER_ID, $this->getId());

				$this->collStatementAnswers = StatementAnswerPeer::doSelectJoinLypoStatement($criteria, $con);
			}
		} else {
									
			$criteria->add(StatementAnswerPeer::USER_ID, $this->getId());

			if (!isset($this->lastStatementAnswerCriteria) || !$this->lastStatementAnswerCriteria->equals($criteria)) {
				$this->collStatementAnswers = StatementAnswerPeer::doSelectJoinLypoStatement($criteria, $con);
			}
		}
		$this->lastStatementAnswerCriteria = $criteria;

		return $this->collStatementAnswers;
	}

	
	public function initReactions()
	{
		if ($this->collReactions === null) {
			$this->collReactions = array();
		}
	}

	
	public function getReactions($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collReactions === null) {
			if ($this->isNew()) {
			   $this->collReactions = array();
			} else {

				$criteria->add(ReactionPeer::USER_ID, $this->getId());

				ReactionPeer::addSelectColumns($criteria);
				$this->collReactions = ReactionPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ReactionPeer::USER_ID, $this->getId());

				ReactionPeer::addSelectColumns($criteria);
				if (!isset($this->lastReactionCriteria) || !$this->lastReactionCriteria->equals($criteria)) {
					$this->collReactions = ReactionPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastReactionCriteria = $criteria;
		return $this->collReactions;
	}

	
	public function countReactions($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ReactionPeer::USER_ID, $this->getId());

		return ReactionPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addReaction(Reaction $l)
	{
		$this->collReactions[] = $l;
		$l->setUser($this);
	}


	
	public function getReactionsJoinLypoStatement($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collReactions === null) {
			if ($this->isNew()) {
				$this->collReactions = array();
			} else {

				$criteria->add(ReactionPeer::USER_ID, $this->getId());

				$this->collReactions = ReactionPeer::doSelectJoinLypoStatement($criteria, $con);
			}
		} else {
									
			$criteria->add(ReactionPeer::USER_ID, $this->getId());

			if (!isset($this->lastReactionCriteria) || !$this->lastReactionCriteria->equals($criteria)) {
				$this->collReactions = ReactionPeer::doSelectJoinLypoStatement($criteria, $con);
			}
		}
		$this->lastReactionCriteria = $criteria;

		return $this->collReactions;
	}

	
	public function initReactionRespects()
	{
		if ($this->collReactionRespects === null) {
			$this->collReactionRespects = array();
		}
	}

	
	public function getReactionRespects($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collReactionRespects === null) {
			if ($this->isNew()) {
			   $this->collReactionRespects = array();
			} else {

				$criteria->add(ReactionRespectPeer::USER_ID, $this->getId());

				ReactionRespectPeer::addSelectColumns($criteria);
				$this->collReactionRespects = ReactionRespectPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ReactionRespectPeer::USER_ID, $this->getId());

				ReactionRespectPeer::addSelectColumns($criteria);
				if (!isset($this->lastReactionRespectCriteria) || !$this->lastReactionRespectCriteria->equals($criteria)) {
					$this->collReactionRespects = ReactionRespectPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastReactionRespectCriteria = $criteria;
		return $this->collReactionRespects;
	}

	
	public function countReactionRespects($criteria = null, $distinct = false, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ReactionRespectPeer::USER_ID, $this->getId());

		return ReactionRespectPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addReactionRespect(ReactionRespect $l)
	{
		$this->collReactionRespects[] = $l;
		$l->setUser($this);
	}


	
	public function getReactionRespectsJoinReaction($criteria = null, $con = null)
	{
				if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collReactionRespects === null) {
			if ($this->isNew()) {
				$this->collReactionRespects = array();
			} else {

				$criteria->add(ReactionRespectPeer::USER_ID, $this->getId());

				$this->collReactionRespects = ReactionRespectPeer::doSelectJoinReaction($criteria, $con);
			}
		} else {
									
			$criteria->add(ReactionRespectPeer::USER_ID, $this->getId());

			if (!isset($this->lastReactionRespectCriteria) || !$this->lastReactionRespectCriteria->equals($criteria)) {
				$this->collReactionRespects = ReactionRespectPeer::doSelectJoinReaction($criteria, $con);
			}
		}
		$this->lastReactionRespectCriteria = $criteria;

		return $this->collReactionRespects;
	}

} 